package labox.innovation.gameserver.model;

/**
 *	一个掉落列表的掉落数量模板
 */
public final class FuzeDropCategoryDrop {

	/**
	 * 掉落的道具数量
	 */
	private int _num;

	/**
	 * 道具掉落的概率
	 */
	private int _chance;

	public FuzeDropCategoryDrop(int num, int chance) {
		_num = num;
		_chance = chance;
	}

	/**
	 * Returns the ID of the item dropped
	 * @return int
	 */
	public int getNum() {
		return _num;
	}

	/**
	 * Sets the count of the item dropped
	 * @param num : int designating the ID of the item
	 */
	public void setNum(int num) {
		_num = num;
	}

	/**
	 * Returns the chance of having a drop
	 * @return int
	 */
	public int getChance() {
		return _chance;
	}

	/**
	 * Sets the chance of having the item for a drop
	 * @param chance : int designating the chance
	 */
	public void setChance(int chance) {
		_chance = chance;
	}

	/**
	 * Returns a report of the object
	 * @return String
	 */
	@Override
	public String toString() {
		String out = "ItemID: " + getNum() + " Chance: " + (getChance() / 10000.0) + "%";
		return out;
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + _num;
		return result;
	}

	/**
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof FuzeDropCategoryDrop))
			return false;
		final FuzeDropCategoryDrop other = (FuzeDropCategoryDrop) obj;
		if (_num != other._num)
			return false;
		return true;
	}
}
